|
|
|
|
|
|
|
considerations help keep the performance of your programs as crisp as possible and help keep your users from running into problems: |
|
|
|
|
|
|
|
|
Each new child window that is loaded consumes memory. Having memory-intensive child windows causes your application to drain memory quickly, so keep the amount of code and the number of controls in your child windows to a minimum. |
|
|
|
|
|
|
|
|
If your child and parent windows have the same menu commands (such as File, Open or File, Exit), keep the code in the parent. This means your child form's menu Click event procedures should simply call the parent menu's Click event procedure for all shared code. |
|
|
|
|
|
|
|
|
Change all of your menu Click event procedures from Private to Public so your child and parent windows can share these events. |
|
|
|
|
|
|
|
|
Avoid using the Name property of your child form. Instead, your child forms should use Me (or nothing at all), and your parent form should use ActiveForm. |
|
|
|
|
|
|
|
|
Put all invisible controls (such as a common dialog control or image list) on the MDI parent form. This allows all of your child windows to share these controls, without consuming extra memory. |
|
|
|
|
|
|
|
|
Adhering to these concepts both simplifies your code and improves the performance of your MDI application. |
|
|
|
|
|
|
|
|
Creating an MDI Application Framework |
|
|
|
|
|
|
|
|
The code shown in this section is designed to provide a basic skeleton for any MDI applications that you create. The skeleton code can be modified to suit your specific needs. Then you can use the skeleton project as a template for your other MDI applications. The completed application is shown in Figure 17.22. |
|
|
|
|
|
|
|
|
Figure 17.22
Creating a template project can simplify your future MDI work. |
|
|
|
|
|